package se.teamscape.shared.model;

import java.util.Date;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

/**
 * Model/entity representation of a team player.
 * 
 * @author Andreas Borglin
 * 
 */
@SuppressWarnings("serial")
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class TeamPlayer implements Model {

    public static final String TEAMKEY_FIELD = "teamKey";
    public static final String PERSONKEY_FIELD = "personKey";

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
    private String encodedKey;

    @Persistent
    private String teamKey;

    @Persistent
    private String personKey;

    @Persistent
    private String personName;

    @Persistent
    private Boolean active;

    @Persistent
    private String position;

    @Persistent
    private String shirtNumber;

    @Persistent
    private Date joinDate;

    @Persistent
    private String otherInfo;

    public TeamPlayer() {

    }

    @Override
    public String getId() {
        return encodedKey;
    }

    @Override
    public String getDisplayName() {
        return personName;
    }

    public void setTeamKey(String teamKey) {
        this.teamKey = teamKey;
    }

    public String getTeamKey() {
        return teamKey;
    }

    public void setPersonKey(String personKey) {
        this.personKey = personKey;
    }

    public String getPersonKey() {
        return personKey;
    }

    public void setPersonName(String personName) {
        this.personName = personName;
    }

    public String getPersonName() {
        return personName;
    }

    public void setActive(Boolean active) {
        this.active = active;
    }

    public Boolean getActive() {
        return active;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public String getPosition() {
        return position;
    }

    public void setShirtNumber(String shirtNumber) {
        this.shirtNumber = shirtNumber;
    }

    public String getShirtNumber() {
        return shirtNumber;
    }

    public void setJoinDate(Date joinDate) {
        this.joinDate = joinDate;
    }

    public Date getJoinDate() {
        return joinDate;
    }

    public void setOtherInfo(String otherInfo) {
        this.otherInfo = otherInfo;
    }

    public String getOtherInfo() {
        return otherInfo;
    }

}
